from pydantic import BaseModel, Field
from typing import List, Optional, Dict

# 企业级工单处理流程的状态定义
class TicketState(BaseModel):
    ticket_id: str = Field(..., description="工单唯一标识")
    user_query: str = Field(..., description="用户原始请求")
    intent: Optional[str] = Field(None, description="意图识别结果（如'售后'/'咨询'）")
    category: Optional[str] = Field(None, description="工单分类（如'产品故障'/'退款'）")
    assigned_to: Optional[str] = Field(None, description="分配的处理人员")
    process_result: Optional[Dict] = Field(None, description="处理结果")
    history: List[Dict] = Field(default_factory=list, description="节点执行历史（审计用）")
    is_approved: Optional[bool] = Field(None, description="工单是否通过审批")
    modification_count: int = Field(default=0, description="修改次数计数")
    is_final_rejection: bool = Field(default=False, description="是否为最终拒绝")


if __name__ == '__main__':
    class person(BaseModel):
        name: str = Field(..., description="人员姓名")
        age: int = Field(..., description="人员年龄")
    p1 = person(name="张三", age="30")
    print(p1.age, type(p1.age))
